package com.cjj.mvpsample.view.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.cjj.mvpsample.R;
import com.cjj.mvpsample.presenter.UserPresenter;
import com.cjj.mvpsample.view.iview.IUserView;

/**
 * 用户信息页面
 * MVP中的V
 * @Author：Created by cjj on 16/8/9.
 * @Blog：jianjunchen.net
 */
public class UserActivity extends BaseActivity<IUserView,UserPresenter> implements IUserView{
    private TextView tv = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        tv = (TextView) findViewById(R.id.tv);
        setData();
    }

    @Override
    public UserPresenter createPresenter() {
        return new UserPresenter();
    }

    private void setData(){
        presenter.setData();
    }

    public void show(View v){
        presenter.showUserInfo();
    }

    @Override
    public void showUserInfo(String msg) {
        tv.setText(msg);
    }

}
